home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / ObjInt.h < prev    next >
C/C++ Source or Header  |  1992-04-27  |  911b  |  48 lines

  1. #ifndef ObjInt_First
  2. #ifdef __GNUG__
  3. //pragma once
  4. #pragma interface
  5. #endif
  6. #define ObjInt_First
  7.  
  8. #include "Object.h"
  9.  
  10. //---- ObjInt ------------------------------------------------------------------
  11.  
  12. class ObjInt: public Object {
  13.     int val;
  14. public:
  15.     MetaDef(ObjInt);
  16.  
  17.     ObjInt(int v= 0)
  18.     { val= v; }
  19.  
  20.     int GetValue()                     
  21.     { return val; }
  22.     int SetValue(int newval)           
  23.     { val= newval; Changed(); return val; }
  24.     int operator= (int newval)
  25.     { return SetValue(newval); }
  26.     int operator++ ()
  27.     { return SetValue(GetValue()+1); }
  28.     int operator-- ()
  29.     { return SetValue(GetValue()-1); }
  30.     operator int()
  31.     { return val; }
  32.  
  33.     //---- comparing
  34.     u_long Hash();
  35.     bool IsEqual(Object*);
  36.     int Compare(Object*);
  37.  
  38.     //---- converting
  39.     char* AsString();
  40.  
  41.     //---- activation passivation
  42.     OStream& PrintOn(OStream&);
  43.     IStream& ReadFrom(IStream&);
  44. };
  45.  
  46. #endif
  47.  
  48.